package com.training.bt.mapper;

import com.training.bt.entity.Promotion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface PromotionMapper extends BaseMapper<Promotion> {
    // 查询所有生效的活动
    List<Promotion> selectByIsActiveTrue();

    // 查询正在进行的活动（当前时间在开始和结束时间之间）
    List<Promotion> selectByIsActiveTrueAndStartTimeBeforeAndEndTimeAfter(LocalDateTime now);
}